<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=7">
    <title>悦定后台管理系统</title>

    <!--判断是否登陆-->
    <script type="text/javascript" src="../../vendor/jquery-2.0.3.min.js"></script>
    <script type="text/javascript" src="../../js/config.js"></script>
    <script type="text/javascript" src="../../js/jquerySession.js"></script>
    <script type="text/javascript">
        if ($.session.get('token') == null) {
            alert("用户未登录！");
            window.location.href = "../../login.html"
        }
    </script>

    <link href="../../css/reset.css" rel="stylesheet" type="text/css">
    <link href="../../css/system.css" rel="stylesheet" type="text/css">
    <link href="../../css/table_form.css" rel="stylesheet" type="text/css">
    <link rel="alternate stylesheet" type="text/css" href="../../css/styles2.css" title="styles2" media="screen">
    <link rel="alternate stylesheet" type="text/css" href="../../css/styles3.css" title="styles3" media="screen">
    <link rel="alternate stylesheet" type="text/css" href="../../css/styles4.css" title="styles4" media="screen">
    <script language="javascript" type="text/javascript" src="../../vendor/jquery.min.js"></script>
    <script language="javascript" type="text/javascript" src="../../js/admin_common.js"></script>
    <script language="javascript" type="text/javascript" src="../../js/styleswitch.js"></script>
    <script language="javascript" type="text/javascript" src="../../js/formvalidator.js" charset="UTF-8"></script>
    <script language="javascript" type="text/javascript" src="../../js/formvalidatorregex.js" charset="UTF-8"></script>
    <script charset="utf-8" src="../../vendor/kindeditor-all.js"></script>
    <script charset="utf-8" src="../../vendor/zh-CN.js"></script>
    <script type="text/javascript">
        var editor;
        KindEditor.ready(function (K) {
            editor = K.create('textarea[name="content"]', {
                uploadJson: baseUrl + '/uploadImage',//上传
//                fileManagerJson: 'http://127.0.0.1:8080/api/v1/fileUpload1',//文件管理
                allowFileManager: false,
                allowUpload:true,
                afterBlur: function () {
                    this.sync();
                }  //数据同步
            });
        });

        //获取url地址传递过来的参数
        function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]);
            return null;
        }
        var id = getUrlParam("matchId");

        $.getJSON(baseUrl + "/matches/" + id, function (json) {
            if (json.meta.code == "200") {
                var data = json.data;
                $("#thumbnail").attr("src", data.thumbnail);
                $("#matchName").val(data.title);
                $("#matchPlace").val(data.matchPlace);
                $("#sponsor").val(data.sponsor);
                $("#phone").val(data.phoneNumber);
                $("#price").val(data.price);
                $("#enroll_startDate").val(formatToYYYY_MM_DD(data.enrollStart));
                $("#enroll_endDate").val(formatToYYYY_MM_DD(data.enrollEnd));
                $("#match_startDate").val(formatToYYYY_MM_DD(data.matchStart));
                $("#match_endDate").val(formatToYYYY_MM_DD(data.matchEnd));
                editor.html(data.introduction)
            }
        })

    </script>
    <script type="text/javascript">
        window.focus();
    </script>

    <link href="../../css/default.css" rel="stylesheet" type="text/css">
    <style type="text/css">
        .uploader {
            position: relative;
            display: inline-block;
            overflow: hidden;
            cursor: default;
            padding: 0;
            margin-left: 50px;
            margin-bottom: 10px;
            -moz-box-shadow: 0px 0px 5px #ddd;
            -webkit-box-shadow: 0px 0px 5px #ddd;
            box-shadow: 0px 0px 5px #ddd;
            -moz-border-radius: 5px;
            -webkit-border-radius: 5px;
            border-radius: 5px;
        }

        .filename {
            float: left;
            display: inline-block;
            outline: 0 none;
            height: 32px;
            width: 220px;
            margin: 0;
            padding: 8px 10px;
            overflow: hidden;
            cursor: default;
            border: 1px solid;
            border-right: 0;
            font: 9pt/100% Arial, Helvetica, sans-serif;
            color: #777;
            text-shadow: 1px 1px 0px #fff;
            text-overflow: ellipsis;
            white-space: nowrap;
            -moz-border-radius: 5px 0px 0px 5px;
            -webkit-border-radius: 5px 0px 0px 5px;
            border-radius: 5px 0px 0px 5px;
            background: #f5f5f5;
            background: -moz-linear-gradient(top, #fafafa 0%, #eee 100%);
            background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fafafa), color-stop(100%, #f5f5f5));
            filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fafafa', endColorstr='#f5f5f5', GradientType=0);
            border-color: #ccc;
            -moz-box-shadow: 0px 0px 1px #fff inset;
            -webkit-box-shadow: 0px 0px 1px #fff inset;
            box-shadow: 0px 0px 1px #fff inset;
            -moz-box-sizing: border-box;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
        }

        .button {
            float: left;
            height: 32px;
            display: inline-block;
            outline: 0 none;
            padding: 8px 12px;
            margin: 0;
            cursor: pointer;
            border: 1px solid;
            font: bold 9pt/100% Arial, Helvetica, sans-serif;
            -moz-border-radius: 0px 5px 5px 0px;
            -webkit-border-radius: 0px 5px 5px 0px;
            border-radius: 0px 5px 5px 0px;
            -moz-box-shadow: 0px 0px 1px #fff inset;
            -webkit-box-shadow: 0px 0px 1px #fff inset;
            box-shadow: 0px 0px 1px #fff inset;
        }

        .uploader input[type=file] {
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            border: 0;
            padding: 0;
            margin: 0;
            height: 30px;
            cursor: pointer;
            filter: alpha(opacity=0);
            -moz-opacity: 0;
            -khtml-opacity: 0;
            opacity: 0;
        }

        input[type=button]::-moz-focus-inner {
            padding: 0;
            border: 0 none;
            -moz-box-sizing: content-box;
        }

        input[type=button]::-webkit-focus-inner {
            padding: 0;
            border: 0 none;
            -webkit-box-sizing: content-box;
        }

        input[type=text]::-moz-focus-inner {
            padding: 0;
            border: 0 none;
            -moz-box-sizing: content-box;
        }

        input[type=text]::-webkit-focus-inner {
            padding: 0;
            border: 0 none;
            -webkit-box-sizing: content-box;
        }
    </style>
</head>

<body>
<div class="subnav">
</div>
<style type="text/css">
    html {
        _overflow-y: scroll
    }

    .table_form tr th {
        width: 80px;
    }

    .table_form tr td input {
        width: 200px;
        height: 25px;
    }
</style>

<form name="myform" id="myform">
    <div class="pad-10">
        <div class="col-tab">
            <div id="div_setting_1" class="contentList pad-10">
                <div class="uploader white">
                    <input type="text" class="filename" readonly/>
                    <input type="button" class="button" value="上传..."/>
                    <input type="file" size="30" name="file" id="file"/>
                </div>
                <table width="100%" class="table_form">
                    <tr>
                        <th>缩略图</th>
                        <td>
                            <img src="#" alt="无" id="thumbnail" width="300px" height="150px"/>
                        </td>
                    </tr>
                    <tr>
                        <th>比赛名称</th>
                        <td>
                            <input type="text" name="matchName" id="matchName" placeholder="比赛名称"/>
                        </td>
                    </tr>
                    <tr>
                        <th>比赛地点</th>
                        <td>
                            <input type="text" name="matchPlace" id="matchPlace" placeholder="比赛地点"/>
                        </td>
                    </tr>
                    <tr>
                        <th>主办方</th>
                        <td>
                            <input type="text" name="sponsor" id="sponsor" placeholder="主办方"/>
                        </td>
                    </tr>
                    <tr>
                        <th>电话号码</th>
                        <td>
                            <input type="text" name="phone" id="phone" placeholder="电话号码"/>
                        </td>
                    </tr>
                    <tr>
                        <th>报名价格</th>
                        <td>
                            <input type="text" name="price" id="price" placeholder="格式为数字，如1、1.0、1.01"/>
                        </td>
                    </tr>
                    <tr>
                        <th>报名开始日期</th>
                        <td>
                            <input type="date" name="enroll_startDate" id="enroll_startDate" placeholder="报名开始日期"/>
                        </td>
                    </tr>
                    <tr>
                        <th>报名截止日期</th>
                        <td>
                            <input type="date" name="enroll_endDate" id="enroll_endDate" placeholder="报名截止日期"/>
                        </td>
                    </tr>
                    <tr>
                        <th>比赛开始日期</th>
                        <td>
                            <input type="date" name="match_startDate" id="match_startDate" placeholder="比赛起止日期"/>
                        </td>
                    </tr>
                    <tr>
                        <th>比赛开始日期</th>
                        <td>
                            <input type="date" name="match_endDate" id="match_endDate" placeholder="比赛起止日期"/>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
    <div class="pad-10">
        <div class="col-tab">
            <div id="div_setting_1" class="contentList pad-10">
                <table width="100%" class="table_form ">
                    <tbody>
                    <tr>
                        <th>比赛详情</th>
                        <td>
                            <div class="ke-container ke-container-default" style="width: 680px;"></div>
										<textarea id="editor_id" name="content"
                                                  style="width: 600px; height: 300px; display: none;">
                            </textarea>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <!--table_form_off-->

</form>
<script type="text/javascript">
    $(function () {

        $("input[type=file]").change(function () {
            $(this).parents(".uploader").find(".filename").val($(this).val());
        });

        $("input[type=file]").each(function () {
            if ($(this).val() == "") {
                $(this).parents(".uploader").find(".filename").val("请选择文件...");
            }
        });

    });
</script>
</body>

</html>